home *** CD-ROM | disk | FTP | other *** search
- DefInt A-Z 'always a good idea (not necessary if you use Option Explicit)
- '--------------------------
- ' System information type .
- ' for 'About' box .
- ' Requires Windows 3.1 or .
- ' Tools.dll .
- '--------------------------
-
- ' Constants for GetWinFlags
- Global Const WF_CPU286 = &H2
- Global Const WF_CPU386 = &H4
- Global Const WF_CPU486 = &H8
- Global Const WF_80x87 = &H400
- Global Const WF_STANDARD = &H10
- Global Const WF_ENHANCED = &H20
-
- Type SYSHEAPINFO
- dwSize As Long
- wUserFreePercent As Integer
- wGDIFreePercent As Integer
- hUserSegment As Integer
- hGDISegment As Integer
- End Type
-
- Declare Function GetVersion Lib "Kernel" () As Integer
- Declare Function GetWinFlags Lib "Kernel" () As Long
- Declare Function GetFreeSpace Lib "Kernel" (ByVal wFlags As Integer) As Long
- Declare Function GlobalCompact Lib "Kernel" (ByVal dwMinFree As Long) As Long
- Declare Function SystemHeapInfo Lib "toolhelp.dll" (shi As SYSHEAPINFO) As Integer
-
- Sub ShowResources (L As Control)
- 'L is a Label control that will display the resource info
-
- Dim nl As String 'new line
- Dim msg As String 'the text that will be displayed in the Label.Caption
-
- nl = Chr$(10)
- ver = GetVersion()
- ver_major$ = Format$(ver And &HFF)
- ver_minor$ = Format$(ver \ &H100, "00")
- msg = "Microsoft Windows version "
- msg = msg + ver_major$ + "." + ver_minor$ + nl
-
- ' Get CPU type and operating mode
- status& = GetWinFlags()
- If status& And WF_CPU286 Then msg = msg + "286"
- If status& And WF_CPU386 Then msg = msg + "386"
- If status& And WF_CPU486 Then msg = msg + "386" 'even though its a 486, we are still in 386 enhanced mode
- If status& And WF_STANDARD Then msg = msg + " Standard Mode" + nl
- If status& And WF_ENHANCED Then msg = msg + " Enhanced Mode" + nl
-
- If status& And WF_80x87 Then
- msg = msg + "Math Co-processor Present"
- Else
- msg = msg + "Math Co-processor none"
- End If
- msg = msg + nl
-
- ' Get free memory
- memory& = GetFreeSpace(0)
- msg = msg + "Memory: "
- msg = msg + Format$(memory& \ 1024, "###,###,###") + "K" + nl
-
- ' The follow lines take a long time to execute.
- 'memory& = GlobalCompact(&HFFFFFFFF)
- 'msg = msg + "Largest free block: "
- 'msg = msg + Format$(memory& \ 1024, "###,###,###") + "K" + nl
-
- ' Get free system resources
- ' The API SystemHeapInfo became available in Windows version 3.1
- If ver >= &H310 Then
- Dim shi As SYSHEAPINFO
- shi.dwSize = Len(shi)
- If SystemHeapInfo(shi) Then
- msg = msg + "User:" + Format$(shi.wUserFreePercent) + "" + Space$(9) + "GDI:" + Format$(shi.wGDIFreePercent) + ""
- End If
- End If
- L.Caption = msg
-
- End Sub
-
-